<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ include file="../../../inc/global.jsp" %>
<compress:html compressCss="true" compressJavaScript="true" enabled="true">
<%@ include file="../../top.jsp" %>
<!doctype html>
<html>
<head>
    <title><fmt:message key="jsp.title.mall.admin.product.item.sku"/></title>
    <%@ include file="../head.jsp" %>
    <style type="text/css">
        .btn {
            width: 80px;
            max-width: 80px;
            display: inline-block;
        }

        .btn a, .btn a:link, .btn a:visited {
            display: inline-block;
            width: 80px;
            height: 25px;
            line-height: 25px;
            text-align: center;
            background: #ffe45c;
            -moz-border-radius: 1px;
            border-radius: 1px;
            cursor: pointer;
        }
        table td {text-indent:5px;}
        table td em {
            color: #666;
            margin-left: 0px;
            display: block;
        }
    </style>
    <script type="text/javascript" src="/static/editor/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/static/editor/ueditor/ueditor.all.js"></script>
    <script type="text/javascript" src="/static/editor/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        function SpuAttrs() {
            var _this = this;
            this.getAttrs = function (spuId) {
                if (spuId == undefined) {
                    return ;
                }
                var url = '/mall/ajax/item/spu/attrs?spuId=' + spuId;
                $.ajax({
                    url: (url),
                    type: 'GET',
                    success: function (data) {
                        $('#attrs').html(data);
                        var vals = $('#checkedVals').html();
                        if (undefined != vals && vals.length > 0) {
                            var array = vals.split(',');
                            for (var i = 0; i < array.length; i++) {
                                var id = array[i].trim();
                                if (id.length > 0) {
                                    $('#' + id).attr('checked', 'checked');
                                }
                            }
                        }
                    }
                });
            };
        }
        var attrs = new SpuAttrs();

    </script>
</head>
<body>
<div id="dialog-upload" style="display: none;">

</div>
<div class="main">
    <div class="wrapper">
        <%@include file="../../header.jsp" %>
        <%@include file="../sidebar.jsp" %>
        <!-- sidebar end -->
        <div class="content item-form">
            <div class="menu-tab">
                <ul>
                    <li><a href="/mall/adm/product/inventory"><fmt:message
                            key="jsp.menu-tab.mall.admin.product.inventory.list"/></a></li>
                    <li><a href="/mall/adm/product/inventory/items"><fmt:message
                            key="jsp.menu-tab.mall.admin.product.inventory.spu"/></a></li>
                    <li class="slt"><a href="###"><fmt:message
                            key="jsp.menu-tab.mall.admin.product.inventory.add"/></a></li>
                </ul>
            </div>
            <table>
                <tr>
                    <th>搜索您要入库的商品</th>
                    <td style="color: green; font-weight:bold;">
                        <c:forEach var="nav" items="${navList}">${nav.name} | </c:forEach>${spu.name} | ${spu.displayName}
                        <input type="hidden" id="spuId" name="spuId" value="${spu.id}"/>
                    </td>
                </tr>
                <tr>
                    <th>商品展示名称</th>
                    <td>
                        <input type="text" id="name" name="name" value="${spu.displayName}"/>
                        <em>商品销售时展示给顾客看的名称，一般包含品牌型号和简要描述，不能大于200个字符！</em>
                    </td>
                </tr>
                <tr>
                    <th>商品销售属性</th>
                    <td>
                        <a href="###">增加属性</a>
                        <div id="attrs" class="attrs">

                        </div>
                    </td>
                </tr>
                <tr>
                    <th>商品封面图</th>
                    <td>
                        <a href="###">上传封面图</a>
                        <div id="covers" class="covers">

                        </div>
                    </td>
                </tr>
                <tr>
                    <th>零售价格</th>
                    <td>
                        <input type="text" id="retailPrice" name="retailPrice" value="0"/>
                    </td>
                </tr>
                <tr>
                    <th>本站特价</th>
                    <td>
                        <input type="text" id="ourPrice" name="ourPrice" value="0"/>
                    </td>
                </tr>
                <tr>
                    <th>商品描述/详情</th>
                    <td>
                        <script type="text/plain" id="myEditor" style="width:900px;height:240px;">
                            <p>此处可以图文搭配填写商品描述和商品详情</p>


                        </script>
                        <script type="text/javascript">
                            var ue = UE.getEditor('myEditor', {
                                //这里可以选择自己需要的工具按钮名称,此处仅选择如下七个
                                toolbar: ['fullscreen source undo redo bold italic underline'],
                                //focus时自动清空初始化时的内容
                                autoClearinitialContent: true,
                                //关闭字数统计
                                wordCount: false,
                                //关闭elementPath
                                elementPathEnabled: false,
                                //默认的编辑区域高度
                                initialFrameHeight: 300
                                //更多其他参数，请参考umeditor.config.js中的配置项
                            });
                        </script>
                    </td>
                </tr>
                <tfoot>
                <tr>
                    <th></th>
                    <td>
                        <input type="button" id="save" value="<fmt:message key="message.button.sure.save"/>"/>
                        <input type="hidden" id="id" value="${id}"/>

                        <div id="checkedVals" style="display:none"><c:forEach var="item"
                                                                              items="${attrValList}">${item.id},</c:forEach></div>
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>
</body>
</html>
<%@ include file="../../bottom.jsp" %>
</compress:html>